A method for optimized code debugging and especially a method for determining the status of variables during an execution of optimized code.
A debugger is a software tool that enables a user to analyze and probe another computer program, the other computer program is referred to as the debugged computer program. A common method to analyze and probe the debugged computer program involves the execution of portions or steps of the debugged computer program. Usually, a user can execute a single instruction or statement and check various variables or other indications that can help the user to debug the debugged computer program.
There is a growing need to enhance the efficiency of software execution. One method for achieving said goal is to receive a source code and to compile it in a manner that provides an optimized object code. A compiler compiles the source code in a manner that best fits the hardware that is supposed to execute the object code. Such an optimization is vital when the software is to executed by parallel processors, but is also of great significant in other cases.
A premium is placed upon optimizing computer programs that are written in high level languages such as C++, C, Java. Writing computer program in these languages is easier than writing computer programs in low level languages such a assembler. Furthermore, a single software program written in high level language can be easily compiled to a plurality of low level language computer programs, to fit a plurality of processors. The efficiency of non-optimized object code that is generated by a non-optimizing compiler from a computer program that is written in a high level language is considerably worse than that of the corresponding assembly language code. Therefor, there is a need to optimize the object code.
The optimization process can largely complicate the relationship between the source code and the object code, so that the debugging of optimized code is very complex. The complexity can be attributed to various factors. A major factor is that during the optimization process statements are executed out of order and instructions are interleaved, i.e., a code can be moved out of sequence so that part of a statement, or a complete statement, is moved in relation to other statements causing that variables are assigned their values out of order.
A debugger must be able to retrieve and display the values of source variables in a manner consistent with what a user may expect with respect to the source statement where execution has halted. When a program has been compiled with optimizations, mappings between breakpoints in the source and object code become complicated, and values of variables may either be inaccessible in the run-time state or inconsistent with what the user expects.
Thus, the debugger not only has to determine a variable""s storage location or associated register. The debugger must also verify the status of the value, i.e., the correspondence of the actual value of the variable to the value that the variable would have in non-optimized code. A variable is current if both values are equal.
A thorough review of prior art optimized code debuggers can be found at the following article: R. F. Brender, J. E. Nelson and M. E. Arsenault xe2x80x9cDebugging Optimized Code: Concepts and Implementation on DIGITAL Alpha Systems,xe2x80x9d Digital Technical Journal, Dec. 10 1998xe2x80x9d. As seen from this article prior art methods of determining the status of variables during the execution of optimized code were vary limited.
There is a need to provide a method for allowing an efficient determination of the status of variables during the execution of optimized code.